function Person() {
  this.name = "xjh";
}

Person.prototype.eating = function () {
  console.log(this.name + "eating ~~");
};

function Student() {
  this.sno = 111;
}

// 重要代码!!!
Student.prototype = new Person();

Student.prototype.studying = function () {
  console.log(this.name + "studying");
};

var stu = new Student();
console.log(stu.name);
stu.eating();
